<?php

namespace app\index\controller;

use app\admin\model\Users;
use think\Controller;
use think\Exception;

class Index extends Controller
{
    public function index()
    {

        $icontypes   = json_encode(my_icontypes());
        $centerpoint = '';
        $zoom        = '';
        $area_id     = 0;

        return $this->fetch('', compact('icontypes', 'centerpoint', 'zoom', 'area_id'));
    }


    public function area()
    {

        $m    = new Users();
        $id   = input('id');
        $user = $m->getById($id);
        if (empty($id) || empty($user)) {
            $this->redirect('/index/index/index');
        }
        $icontypes   = my_icontypes($id);
        $centerpoint = $user->centerpoint;
        $zoom        = $user->zoom;
        $area_id     = $id;

        return $this->fetch('', compact('icontypes', 'centerpoint', 'zoom', 'area_id'));
    }

    public function test()
    {
        $data = influx_get(['userid'=>2]);
        P($data);
    }

}
